home *** CD-ROM | disk | FTP | other *** search
- ; _setmem.a - set memory block to a value.
- ; (C) Copyright 1984 Gregory R. Mansfield. - All Rights Reserved.
- ; G. R. Mansfield. 85/01/16.
- ; Ver 1.0-5329.
-
-
- cseg
- public _setmem_
-
-
- ; _setmem(a, n, v) /* set block to value */
- ; SEGSIZE n; /* number of bytes to set */
- ; BYTE *a, v; /* source, destination */
-
- _setmem_:
- mov bx,sp
- stm1: mov cx,[bx+4] ; count
- jcxz stm3 ; if nothing to store
- push es
- mov ax,[bx+6] ; value
- mov di,[bx+2] ; destination offset
- push ds
- pop es
- mov ah,al
- shr cx,1 ; store words
- repz stosw
- jnb stm2 ; store remaining byte
- stosb
- stm2: pop es
- stm3: ret
-